use core::{SourceMap, Package, PackageId, PackageSet, Target, Resolve};
use core::{Profile, Profiles};
-use util::{self, CargoResult, human, caused_human};
+use util::{self, CargoResult, human};
use util::{Config, internal, ChainError, Fresh, profile, join_paths};
use self::job::{Job, Work};
trace!("commands={}", rustdoc);
- let primary = package.package_id() == cx.resolve.root();
let name = package.name().to_string();
let desc = rustdoc.to_string();
let exec_engine = cx.exec_engine.clone();
Ok(Work::new(move |desc_tx| {
desc_tx.send(desc).unwrap();
- if primary {
- try!(exec_engine.exec(rustdoc).chain_error(|| {
- human(format!("Could not document `{}`.", name))
- }))
- } else {
- try!(exec_engine.exec_with_output(rustdoc).and(Ok(())).map_err(|err| {
- match err.exit {
- Some(..) => {
- caused_human(format!("Could not document `{}`.",
- name), err)
- }
- None => {
- caused_human("Failed to run rustdoc", err)
- }
- }
- }))
- }
- Ok(())
+ exec_engine.exec(rustdoc).chain_error(|| {
+ human(format!("Could not document `{}`.", name))
+ })
}))
}
+use std::str;
+
use support::{project, execs, path2url};
use support::{COMPILING, RUNNING};
use hamcrest::{assert_that, existing_file, existing_dir, is_not};
execs().with_status(0));
});
+test!(output_not_captured {
+ let p = project("foo")
+ .file("Cargo.toml", r#"
+ [package]
+ name = "foo"
+ version = "0.0.1"
+ authors = []
+
+ [dependencies]
+ a = { path = "a" }
+ "#)
+ .file("src/lib.rs", "")
+ .file("a/Cargo.toml", r#"
+ [package]
+ name = "a"
+ version = "0.0.1"
+ authors = []
+ "#)
+ .file("a/src/lib.rs", "
+ /// ```
+ /// ☃
+ /// ```
+ pub fn foo() {}
+ ");
+
+ let output = p.cargo_process("doc").exec_with_output().err().unwrap()
+ .output.unwrap();
+ let stderr = str::from_utf8(&output.stderr).unwrap();
+ assert!(stderr.contains("☃"), "no snowman\n{}", stderr);
+ assert!(stderr.contains("unknown start of token"), "no message\n{}", stderr);
+});
+
test!(target_specific_documented {
let p = project("foo")
.file("Cargo.toml", &format!(r#"